{extend name="base/main" /}
{block name="body"}
<blockquote class="layui-elem-quote">
    <a class="layui-btn layui-btn-normal" href="create.html">添加数据</a>
</blockquote>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <form class="form-horizontal m-t" action="{:url('rights/index')}" method="get">
    <div class="layui-form-item">
        <div class="layui-input-inline" style="margin-left: 50px">
            <select name="title" lay-verify="required" style="width: 100px; height: 35px" value="{:input('title')}">
                <option value="0">是否可用</option>
                <option value="1">显示</option>
                <option value="2" selected>不显示</option>
            </select>
            <button class="btn btn-primary btn-sm" type="submit">搜索</button>
        </div>
    </div>
    </form>
</fieldset>
<div class="layui-form">
    <table class="layui-table">
        <colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>编号</th>
            <th>权益名称</th>
            <th>图标</th>
            <th>说明</th>
            <th>排序</th>
            <th>是否可用</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.name}</td>
            <td><img src="{$vo.img}" width="100%"></td>
            <td>{$vo.rights}</td>
            <td>{$vo.sort}</td>
            <td>
                <?php if($vo['status'] == 1){ ?>
                <i class="fa fa-check text-navy"></i>
                <?php }else{ ?>
                <i class="fa fa-check fa-close"></i>
                <?php } ?>
            </td>
            <td>
                <a href="{:url('rights/edit',['id'=>$vo['id']])}" class="btn btn-info btn-xs"><i class="fa fa-paste"></i> 编辑 </a>
                <a href="javascript:void(0);" class="btn btn-danger btn-xs confirm tabledel ajax-post-a" target-form="id" data-id="{$vo.id}" url="{:url('rights/remove',['id'=>$vo['id']])}"><i class="fa fa-trash"></i> 删除 </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</div>
<script>
    var $ = layui.$, active = {
        reload: function(){
            var demoReload = $('#demoReload');

            //执行重载
            table.reload('testReload', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: {
                    key: {
                        id: demoReload.val()
                    }
                }
            });
        }
    };
</script>
{/block}